package lex.profile.utils;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import javax.swing.Icon;
import javax.swing.ImageIcon;

public class IconCache
{
	public static final String PACKAGE = "package.png";
	public static final String PRIVATE = "private.png";
	public static final String PROTECT = "protect.png";
	public static final String PUBLIC = "public.png";
	// =====================================================
	private static final String PATH = "/lex/profile/resources/images/";
	private static final Map<String, Icon> cache = new ConcurrentHashMap<String, Icon>( 20 );

	public static Icon getIcon( String key )
	{
		Icon icon = cache.get( key );
		if( null == icon )
		{
			icon = new ImageIcon( IconCache.class.getResource( PATH + key ) );
			cache.put( key, icon );
		}
		return icon;
	}

	private IconCache()
	{}
}
